tests: Exit valgrind tests if a leak is detected
authorAlexander Larsson <alexl@redhat.com>
Fri, 10 Jun 2016 11:28:08 +0000 (13:28 +0200)
committerAtomic Bot <atomic-devel@projectatomic.io>
Fri, 10 Jun 2016 12:14:40 +0000 (12:14 +0000)
This fails the test if OT_TESTS_VALGRIND is set and valgrind
detects a leak.

Closes: #334
Approved by: cgwalters

tests/libtest.sh

index 2916bdbb58684362a2917fc139c4651dd2d18030..3350cb20fefe80fbedb38e0913d0462528c1e5d1 100755 (executable)
@@ -77,7 +77,7 @@ if test -n "${OT_TESTS_DEBUG:-}"; then
 fi
 
 if test -n "${OT_TESTS_VALGRIND:-}"; then
-    CMD_PREFIX="env G_SLICE=always-malloc OSTREE_SUPPRESS_SYNCFS=1 valgrind -q --leak-check=full --num-callers=30 --suppressions=${test_srcdir}/glib.supp --suppressions=${test_srcdir}/ostree.supp"
+    CMD_PREFIX="env G_SLICE=always-malloc OSTREE_SUPPRESS_SYNCFS=1 valgrind -q --error-exitcode=1 --leak-check=full --num-callers=30 --suppressions=${test_srcdir}/glib.supp --suppressions=${test_srcdir}/ostree.supp"
 else
     CMD_PREFIX="env LD_PRELOAD=${test_builddir}/libreaddir-rand.so"
 fi